package annotation;

import org.openqa.selenium.By;

public enum LocatorType {
    ID, CSS, XPATH, NAME;

    public By asBy(String location) {
        switch (this) {
            case ID:
                return By.id(location);
            case CSS:
                return By.cssSelector(location);
            case XPATH:
                return By.xpath(location);
            case NAME:
                return By.name(location);
            default:
                return null;
        }
    }
}
